﻿/**
 *       Project: ServerLib
 *     Copyright: Copyright (C) 2008, Rob Kennedy
 *   Create Date: 2008-07-14 10:16 PM
 * Modified Date: 2008-07-14 10:16 PM    RK  Added comments
 *      Comments: Ignore SA1633.
 *      
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

namespace ServerLib.Network.Dns
{
    using System;
    using System.Collections.Generic;

    /// --------------------------------------------------------------------
    /// Project	 : ServerLib
    /// Class	 : MXCacheDomain
    /// Inherits : None.
    /// --------------------------------------------------------------------
    /// <summary>
    /// Dns MX host cache record used to cache a list of MX host records
    /// for a specific domain domain for a given period. Saves having to
    /// lookup a MX record on every email.
    /// </summary>
    /// <authorname>Rob Kennedy</authorname>
    /// <remarks></remarks>
    /// --------------------------------------------------------------------
    public class MXCacheDomain
    {
        #region Private Properties

        /// <summary>Contains the cache domain name reference</summary>
        private string domainName;

        /// <summary>Cotains the date and time this record was last updated</summary>
        private DateTime lastLookupDateTime;

        /// <summary>Contains a collection of associated MXRecords cached for the domain</summary>
        private List<MXRecord> cachedRecords = new List<MXRecord>();

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets the cache domain name reference
        /// </summary>
        public string DomainName
        {
            get
            {
                return this.domainName;
            }
            
            set
            {
                this.domainName = value;
            }
        }

        /// <summary>
        /// Gets or sets the last date and time this record was updated
        /// </summary>
        public DateTime LastLookupDateTime
        {
            get
            {
                return this.lastLookupDateTime;
            }

            set
            {
                this.lastLookupDateTime = value;
            }
        }

        /// <summary>
        /// Gets a collection of cached MXRecord objects
        /// </summary>
        public List<MXRecord> MXRecords
        {
            get
            {
                return this.cachedRecords;
            }
        }

        #endregion
    }
}
